//
//  OtherBillCell.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/11/5.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class OtherBillCell: UICollectionViewCell {
    
    var title : String! { //标题
        didSet{
           titleLabel.text = title
        }
    }
    
    var image : UIImage! { //图片
        didSet{
            billImageView.image = image
        }
    }
    
    fileprivate let titleLabel = UILabel()
    fileprivate let billImageView = UIImageView()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        billImageView.layer.cornerRadius = RATIO_H(maxNum: 15)
        billImageView.layer.masksToBounds = true
        self.contentView.addSubview(billImageView)
        
        titleLabel.font = UIFont.systemFont(ofSize: RATIO(maxNum: 16))
        self.contentView.addSubview(titleLabel)
        
        billImageView.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(RATIO(maxNum: 20))
            make.centerY.equalToSuperview()
            make.width.height.equalTo(RATIO_H(maxNum: 30))
        }
        
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(billImageView.snp.right).offset(RATIO(maxNum: 10))
            make.centerY.equalToSuperview()
            make.height.greaterThanOrEqualTo(10)
            make.right.equalToSuperview().offset(RATIO(maxNum: -5))
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
}
